package com.zbkj.service.service.standard.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.enquiry.PeEnquiry;
import com.zbkj.common.model.project.ProjectInfo;
import com.zbkj.common.model.standard.PeStandard;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.standard.QueryStandByTypeRequest;
import com.zbkj.service.dao.standard.PeStandardMapper;
import com.zbkj.service.service.standard.IPeStandardService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 标准 服务实现类
 * </p>
 *
 * @author 
 * @since 2025-08-03
 */
@Service
public class PeStandardServiceImpl extends ServiceImpl<PeStandardMapper, PeStandard> implements IPeStandardService {

    @Override
    public PageInfo<PeStandard> standList(QueryStandByTypeRequest pageParamRequest) {
        LambdaQueryChainWrapper<PeStandard> peStandardLambdaQueryChainWrapper = this.lambdaQuery();
        if(ObjectUtil.isNotEmpty(pageParamRequest.getStandardType())){
            peStandardLambdaQueryChainWrapper.eq(PeStandard::getStandardType, pageParamRequest.getStandardType());
        }
        List<PeStandard> list = peStandardLambdaQueryChainWrapper.eq(PeStandard::getDeleteFlag, 0).orderByDesc(PeStandard::getCreateTime).list();
        Page<PeStandard> pageObj = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
        return CommonPage.copyPageInfo(pageObj, list);
    }
}
